<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>FabGL: AnsiTerminal/AnsiTerminal.ino</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">FabGL
   </div>
   <div id="projectbrief">ESP32 VGA Controller and Graphics Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('_ansi_terminal_2_ansi_terminal_8ino-example.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">AnsiTerminal/AnsiTerminal.ino</div>  </div>
</div><!--header-->
<div class="contents">
<p>Serial VT/ANSI Terminal</p>
<div class="fragment"><div class="line"> <span class="comment">/*</span></div><div class="line"><span class="comment">  Created by Fabrizio Di Vittorio (fdivitto2013@gmail.com) - www.fabgl.com</span></div><div class="line"><span class="comment">  Copyright (c) 2019 Fabrizio Di Vittorio.</span></div><div class="line"><span class="comment">  All rights reserved.</span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment">  This file is part of FabGL Library.</span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment">  FabGL is free software: you can redistribute it and/or modify</span></div><div class="line"><span class="comment">  it under the terms of the GNU General Public License as published by</span></div><div class="line"><span class="comment">  the Free Software Foundation, either version 3 of the License, or</span></div><div class="line"><span class="comment">  (at your option) any later version.</span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment">  FabGL is distributed in the hope that it will be useful,</span></div><div class="line"><span class="comment">  but WITHOUT ANY WARRANTY; without even the implied warranty of</span></div><div class="line"><span class="comment">  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span></div><div class="line"><span class="comment">  GNU General Public License for more details.</span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment">  You should have received a copy of the GNU General Public License</span></div><div class="line"><span class="comment">  along with FabGL.  If not, see &lt;http://www.gnu.org/licenses/&gt;.</span></div><div class="line"><span class="comment"> */</span></div><div class="line"></div><div class="line"></div><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="fabgl_8h.html">fabgl.h</a>&quot;</span></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line">TerminalClass Terminal;</div><div class="line"></div><div class="line"></div><div class="line"><span class="keywordtype">void</span> setup()</div><div class="line">{</div><div class="line">  <span class="comment">// for ESP32-PICO-D4 use GPIO 12 (RX) and 2 (TX)</span></div><div class="line">  Serial2.begin(115200, SERIAL_8N1, 12, 2);</div><div class="line"></div><div class="line">  <span class="comment">// other boards</span></div><div class="line">  <span class="comment">//Serial2.begin(115200);</span></div><div class="line"></div><div class="line">  <span class="comment">//Serial.begin(115200); // debug only</span></div><div class="line"></div><div class="line">  <span class="comment">// only keyboard configured on port 0</span></div><div class="line">  PS2Controller.<a name="a0"></a><a class="code" href="classfabgl_1_1_p_s2_controller_class.html#a7082e498e95fd5f5a4edfbe73923f397">begin</a>(PS2Preset::KeyboardPort0);</div><div class="line"></div><div class="line">  VGAController.<a name="a1"></a><a class="code" href="classfabgl_1_1_v_g_a_controller_class.html#acdc8b95372c01a76deeb4abe360d0295">begin</a>();</div><div class="line">  VGAController.<a name="a2"></a><a class="code" href="classfabgl_1_1_v_g_a_controller_class.html#ac190a844ead4bb68817c733fb0c9a5af">setResolution</a>(<a name="a3"></a><a class="code" href="fabglconf_8h.html#ae913dffdd13bd77b79d1a253e88bf22f">VGA_640x350_70HzAlt1</a>, 640, 350);</div><div class="line"></div><div class="line">  <span class="comment">// this speed-up display but may generate flickering</span></div><div class="line">  VGAController.<a name="a4"></a><a class="code" href="classfabgl_1_1_v_g_a_controller_class.html#a7e0814c52bfc5eecd93fbb5ebce8d423">enableBackgroundPrimitiveExecution</a>(<span class="keyword">false</span>);</div><div class="line"></div><div class="line">  Terminal.begin();</div><div class="line">  Terminal.connectSerialPort(Serial2);</div><div class="line">  <span class="comment">//Terminal.setLogStream(Serial);  // debug only</span></div><div class="line"></div><div class="line">  Terminal.setBackgroundColor(<a name="a5"></a><a class="code" href="group___enumerations.html#gga843f6f6094fb6666d0e726d7b0e06f3bab097ba4cce4536843fc9a93b5d7a5af0">Color::Black</a>);</div><div class="line">  Terminal.setForegroundColor(<a name="a6"></a><a class="code" href="group___enumerations.html#gga843f6f6094fb6666d0e726d7b0e06f3ba7edd15d591a436caaec5785a75b1cd80">Color::Green</a>);</div><div class="line">  Terminal.clear();</div><div class="line">  Terminal.enableCursor(<span class="keyword">true</span>);</div><div class="line"></div><div class="line">  Terminal.write(<span class="stringliteral">&quot;* * FabGL - Serial VT/ANSI Terminal\r\n&quot;</span>);</div><div class="line">  Terminal.write(<span class="stringliteral">&quot;* * 2019 by Fabrizio Di Vittorio - www.fabgl.com\r\n\n&quot;</span>);</div><div class="line">  Terminal.printf(<span class="stringliteral">&quot;Screen Size        : %d x %d\r\n&quot;</span>, VGAController.<a name="a7"></a><a class="code" href="classfabgl_1_1_v_g_a_controller_class.html#ad7310c48604f37aec2ea3274fefd405c">getScreenWidth</a>(), VGAController.<a name="a8"></a><a class="code" href="classfabgl_1_1_v_g_a_controller_class.html#af3406190a30fc46070da0a7353da4082">getScreenHeight</a>());</div><div class="line">  Terminal.printf(<span class="stringliteral">&quot;Viewport Size      : %d x %d\r\n&quot;</span>, Canvas.<a name="a9"></a><a class="code" href="classfabgl_1_1_canvas_class.html#aea413b9edfd1ba4d74289a7200bd2fe6">getWidth</a>(), Canvas.<a name="a10"></a><a class="code" href="classfabgl_1_1_canvas_class.html#abf1d0eae0cee9c7606b7a60c8f892ff5">getHeight</a>());</div><div class="line">  Terminal.printf(<span class="stringliteral">&quot;Terminal Size      : %d x %d\r\n&quot;</span>, Terminal.getColumns(), Terminal.getRows());</div><div class="line">  Terminal.printf(<span class="stringliteral">&quot;Keyboard           : %s\r\n\r\n&quot;</span>, Keyboard.<a name="a11"></a><a class="code" href="classfabgl_1_1_keyboard_class.html#a5c07c13d95a52b5c8d91a7328fe17930">isKeyboardAvailable</a>() ? <span class="stringliteral">&quot;OK&quot;</span> : <span class="stringliteral">&quot;Error&quot;</span>);</div><div class="line">  Terminal.printf(<span class="stringliteral">&quot;Free DMA Memory    : %d\r\n&quot;</span>, heap_caps_get_free_size(MALLOC_CAP_DMA));</div><div class="line">  Terminal.printf(<span class="stringliteral">&quot;Free 32 bit Memory : %d\r\n\n&quot;</span>, heap_caps_get_free_size(MALLOC_CAP_32BIT));</div><div class="line">  Terminal.write(<span class="stringliteral">&quot;Connect server to UART2 - 8N1 - 115200 baud\r\n\n&quot;</span>);</div><div class="line"></div><div class="line">  Terminal.setForegroundColor(<a name="a12"></a><a class="code" href="group___enumerations.html#gga843f6f6094fb6666d0e726d7b0e06f3baf09d081210f708ef088785200c5c616e">Color::BrightGreen</a>);</div><div class="line">}</div><div class="line"></div><div class="line"></div><div class="line"><span class="keywordtype">void</span> loop()</div><div class="line">{</div><div class="line">  Terminal.pollSerialPort();</div><div class="line">}</div></div><!-- fragment --> </div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.14 </li>
  </ul>
</div>
</body>
</html>
